package com.example.demo.scheduled;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author Administrator
 */
@Slf4j
@Component
public class ScheduledTask {

    @Value("${test.node:nothing}")
    private String testMast;

    @Value("${test.node1:nothing}")
    private String test1;

    @Value("${test.node2:nothing}")
    private String test2;

    @Scheduled(cron = "${scheduled.task.cron:*/3 * * * * ?}")
    public void runScheduledTask() {
        log.info("Executing scheduled task {}", new Date());
        log.info("Nodes Information-Master:{};Node1:{};Node2:{}.", testMast, test1, test2);
    }
}
